//
//  SearchViewCell.m
//  JJHW_coreData
//
//  Created by lizhenqiang on 16/4/17.
//  Copyright © 2016年 HFKJ_LZQ. All rights reserved.
//

#import "SearchViewCell.h"
#import "NSString+Attribute.h"
@implementation SearchViewCell

- (void)awakeFromNib {
    // Initialization code
}

-(void)setCellData:(SearchObj *)obj
{
    
    _titleLabel.text = obj.title;
    _contentLabel.text = obj.content;
//    CGFloat titleHeight = [NSString calculateTextHeight:DeviceWidth-30 Content:obj.title font:themeFont15];
//    titleHeight = MIN(36, titleHeight);
//    CGFloat contentHeight = [NSString calculateTextHeight:DeviceWidth-30 Content:obj.content font:themeFont13];
//    contentHeight = MIN(36, contentHeight);
//    CDLog(@"titleHeight=%f && contentHeight=%f",titleHeight,contentHeight);
    _obj = obj;
    _titleLabel.attributedText =[NSString getAttributeFromContentText:obj.title];
    _contentLabel.attributedText =[NSString getAttributeFromContentText:obj.content];
    
//    _titleLabel.frame = CGRectMake(15, 10, DeviceWidth-30, titleHeight);
//    _contentLabel.frame = CGRectMake(15, _titleLabel.frame.origin.y+_titleLabel.frame.size.height+10, DeviceWidth-30, contentHeight);
//    _xianImageView.frame = CGRectMake(15, _contentLabel.frame.origin.y+_contentLabel.frame.size.height+10, DeviceWidth-30, 1);
}

//- (CGSize)sizeThatFits:(CGSize)size {
//    CGFloat totalHeight = 0;
//    totalHeight += [self.titleLabel sizeThatFits:size].height;
//    totalHeight += [self.contentLabel sizeThatFits:size].height;
//    totalHeight += 31; // margins
////    CGFloat titleHeight = [NSString calculateTextHeight:DeviceWidth-30 Content:_obj.title font:themeFont15];
////    titleHeight = MIN(36, titleHeight);
////    CGFloat contentHeight = [NSString calculateTextHeight:DeviceWidth-30 Content:_obj.content font:themeFont13];
////    contentHeight = MIN(36, contentHeight);
////    
////    totalHeight = titleHeight+contentHeight;
////    totalHeight += 31;
//    return CGSizeMake(size.width, totalHeight);
//}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
